﻿@{
    Layout = "~/Areas/Member/Views/_LoginLayoutPage.cshtml";
    ViewBag.Title = "找回密码";
    CurrentUser findUser = (CurrentUser)ViewBag.FindUser;
    string mobile = findUser.Mobile;
    string mobileXxx = "";
    if (StringHelper.IsMobile(mobile))
    {
        mobileXxx = mobile.Substring(0, 3) + "******" + mobile.Substring(8, 3);
    }
    string email = findUser.Email;
    string emailXxx = "";
    if (StringHelper.IsEmail(email))
    {
        int secondStart = email.IndexOf("@");
        emailXxx = email.Substring(0, 2) + "******" + email.Substring(secondStart - 1);
    }

}

<div class="container">
    <div class="loginBox clearfix">

        <div class="content-box">

            <div class="media logo-media"></div>
            <div class="login-sign">找回密码</div>

            <form method="post" id="loginForm" autocomplete="off">
                <div class="validate-all-tips-box"></div>
                <div class="form-group">
                    <label class="control-label">身份验证</label>
                    <div class="controls">
                        <select name="findType" id="findType" class="form-control ui-show-hide" data-validate="dataType:'*',nullMsg:'请选择身份验证方式'">
                            @if (ViewBag.FindByEmail == "1" && !string.IsNullOrEmpty(emailXxx))
                {
                    <option value="email" showObjs=".email-code,.post-area" hideObjs=".sms-code,.else-remark">邮箱验证 @emailXxx</option>
    }

                            @if (ViewBag.FindByMobile == "1" && !string.IsNullOrEmpty(mobileXxx))
                {
                    <option value="mobile" showObjs=".sms-code,.post-area" hideObjs=".email-code,.else-remark">手机验证 @mobileXxx</option>}
                            <option value="else" showObjs=".else-remark" hideObjs=".email-code,.sms-code,.post-area">人工申诉</option>
                        </select>
                        <span class="help-block"></span>
                    </div>
                </div>


                <div class="form-group email-code" style="display:none">
                    <label class="control-label">邮件验证码</label>
                    <div class="controls">
                        <div class="input-group">
                            <input type="hidden" id="email" name="email" value="@email" class="form-control">
                            <input type="text" id="_EmailCode" name="_EmailCode" class="form-control" maxlength="6" placeholder="点击右侧按钮获取验证码" data-validate="ignoreHidden:true,dataType:'numeric',minLength:6,minLengthErrorMsg:'邮件验证码为6位数字！',nullMsg:'请填写邮件验证码',checkUrl:'/E/EmailCode/Validate',checkError:'邮件验证码未通过验证',additionals:'#email'">
                            <span class="input-group-btn">
                                <button type="button" class="btn btn-primary ui-btn-sendCode" data-send-params="type:'email',seconds:100,accordingObj:'#email'">获取验证码</button>
                            </span>
                        </div>
                        <span class="help-block" id="_ValidateTips__EmailCode"></span>
                    </div>
                </div>


                <div class="form-group sms-code" style="display:none">
                    <label class="control-label">手机验证码</label>
                    <div class="controls">
                        <div class="input-group">
                            <input type="hidden" id="mobile" name="mobile" value="@mobile" class="form-control">
                            <input type="text" id="_SmsCode" name="_SmsCode" class="form-control" maxlength="6" placeholder="点击右侧按钮获取验证码" data-validate="ignoreHidden:true,dataType:'numeric',minLength:6,minLengthErrorMsg:'手机验证码为6位数字！',nullMsg:'请填写手机验证码！',checkUrl:'/E/SmsCode/Validate',checkError:'手机验证码未通过验证',additionals:'#mobile'">
                            <span class="input-group-btn">
                                <button type="button" class="btn btn-primary ui-btn-sendCode" data-send-params="type:'mobile',seconds:100,accordingObj:'#mobile'">获取验证码</button>
                            </span>
                        </div>
                        <span class="help-block" id="_ValidateTips__SmsCode"></span>
                    </div>
                </div>

                <div class="form-group else-remark" style="display:none">
                    <label class="control-label">找回说明</label>
                    <div class="controls">
                        <p class="form-control-static">
                            如果您的账户没有绑定邮箱或手机号，只能联系客服人员帮你找回密码。
                        </p>
                        <span class="help-block"></span>
                    </div>
                </div>

                <div class="form-group post-area">
                    <div class="controls controls-submit">
                        @Html.AntiForgeryToken()
                        <button type="button" class="btn btn-primary btn-lg col-xs-12 col-md-12 ui-pagePost" data-custom-params="url:'@Url.ActionUrl("Confirm")',callBack:'Success',successMsg:'',failCallBack:''">下一步</button>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-6 col-xs-6">
                        <a href="@Url.ActionUrl("Index")">上一步</a>
                    </div>

                    <div class="col-md-6 col-xs-6 text-right">
                        没有账户？<a href="@Url.ActionUrl("Index","Reg")" class="text-primary">去注册</a>
                    </div>
                </div>

            </form>
        </div>
    </div>
</div>
<script type="text/javascript">

   function Success(result)
    {
      location.href = "@Url.ActionUrl("ModifyPassword")";
    }
</script>
